-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
treewide: CUDA reformat with nixfmt-rfc-style
#299578
treewide: CUDA reformat with nixfmt-rfc-style
#299578
Conversation
PR="299578"; \
SYSTEM="x86_64-linux"; \
CUDA_SUPPORT="true"; \
CUDA_CAPABILITIES='[ "7.5" ]'; \
nixpkgs-review pr "$PR" \
--system "$SYSTEM" \
--no-shell \
--checkout commit \
--allow aliases \
--build-args "--max-jobs 1" \
--skip-package-regex 'python3(\d){1,2}Packages\.(pytorch-pfn-extras|ffcv)' \
--skip-package-regex 'python3(\d){1,2}Packages\.(shap|mlflow|optuna)' \
--extra-nixpkgs-config "{
allowUnfree = true;
allowBroken = false;
cudaSupport = ${CUDA_SUPPORT:-false};
cudaCapabilities = ${CUDA_CAPABILITIES:-[]};
}" Result of 3 packages built:
|
PR="299578"; \
SYSTEM="aarch64-darwin"; \
CUDA_SUPPORT="false"; \
CUDA_CAPABILITIES='[ ]'; \
nixpkgs-review pr "$PR" \
--system "$SYSTEM" \
--no-shell \
--checkout commit \
--allow aliases \
--build-args "--max-jobs 1" \
--extra-nixpkgs-config "{
allowUnfree = true;
allowBroken = false;
cudaSupport = ${CUDA_SUPPORT:-false};
cudaCapabilities = ${CUDA_CAPABILITIES:-[]};
}" Result of |
PR="299578"; \
SYSTEM="x86_64-darwin"; \
CUDA_SUPPORT="false"; \
CUDA_CAPABILITIES='[ ]'; \
nixpkgs-review pr "$PR" \
--system "$SYSTEM" \
--no-shell \
--checkout commit \
--allow aliases \
--build-args "--max-jobs 1" \
--extra-nixpkgs-config "{
allowUnfree = true;
allowBroken = false;
cudaSupport = ${CUDA_SUPPORT:-false};
cudaCapabilities = ${CUDA_CAPABILITIES:-[]};
}" Result of |
PR="299578"; \
SYSTEM="aarch64-linux"; \
CUDA_SUPPORT="true"; \
CUDA_CAPABILITIES='[ "7.2" ]'; \
nixpkgs-review pr "$PR" \
--system "$SYSTEM" \
--no-shell \
--checkout commit \
--allow aliases \
--build-args "--max-jobs 4" \
--extra-nixpkgs-config "{
allowUnfree = true;
allowBroken = false;
cudaSupport = ${CUDA_SUPPORT:-false};
cudaCapabilities = ${CUDA_CAPABILITIES:-[]};
}" Result of |
PR="299578"; \
SYSTEM="aarch64-linux"; \
CUDA_SUPPORT="true"; \
CUDA_CAPABILITIES='[ "7.5" ]'; \
nixpkgs-review pr "$PR" \
--system "$SYSTEM" \
--no-shell \
--checkout commit \
--allow aliases \
--build-args "--max-jobs 4" \
--extra-nixpkgs-config "{
allowUnfree = true;
allowBroken = false;
cudaSupport = ${CUDA_SUPPORT:-false};
cudaCapabilities = ${CUDA_CAPABILITIES:-[]};
}" Result of 2 packages built:
|
Thanks for doing this @ConnorBaker ! I'm a fan of all things automated formatting. How will we enforce this formatting standard in future PRs? Once things are all pretty and pristine after this PR, what's to stop someone from unknowingly breaking formatting in a subsequent PR? |
I don't know :( As far as I can tell, we don't have any sort of pre-commit hook setup with Nixpkgs. I suppose I could add a new workflow which checks to make sure that the paths formatted by this PR are unchanged when the formatter is run again, but I'm not sure if that's something which is allowed. Any ideas? |
A GitHub Actions workflow? Yeah I think that makes sense. IIUC there's a Perhaps the NixOS/rfcs#166 authors (cc @piegamesde @infinisil) might have input on how to enforce the new formatting standard in CI? |
@samuela see b6024fa48c4240837f276ca603f8176052c7de75 -- I use the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit early, because nixfmt-rfc-style
is not yet stable! We still need to release the first official version, and we planned it to only apply to Nixpkgs after that, see NixOS/nixfmt#153.
That said, I don't see any major problems with code owners manually starting to enforce even the unstable format.
Am I seeing correctly that the reformat is causing a rebuild? If so, would you please investigate this and open a bug report? Nixfmt should never change the code's semantics, and thus never cause any rebuilds. |
Oh and with a more generic check, the @NixOS/nix-formatting team should be added as the workflows code owner |
I would make a GIthub action workflow to just run the changed files in the PR through the formatter and if any |
Is this not the behavior of |
b6024fa
to
c93591b
Compare
@infinisil I've renamed the file and added a comment to make it clear its opt-in.
@SomeoneSerge @piegamesde I've relaxed the run condition so it will trigger on all PRs, but have restricted it to just the relevant CUDA files.
@gabyx @samuela yes, that is what the
@piegamesde @infinisil I've often wondered about those counts, especially for unfree redistributables. If they're calculated naively (e.g., does Hydra have a copy of the package cached?) then it would make sense there are always "rebuilds"; Hydra doesn't build unfree packages (like anything involving CUDA). That the Darwin count is non-zero makes me chuckle, because that's definitely one platform NVIDIA doesn't support, and one which should never be impacted by our changes (unless we, you know, break evaluation). Is there an easy way for me to check exactly what would need to be rebuilt, or to further investigate this? I see the current PR as the minimal amount of work necessary to format the portion of the code the @NixOS/cuda-maintainers team works on, and to keep it formatted. I think it would be a good idea to open an issue on the What are y'all's thoughts on something like that? I think the changes I've made to the PR (finding paths from environment variables) make it flexible enough for a small group of maintainers to opt-in prior to tree-wide formatting, but I wouldn't want to extend it further. |
…kages.nix}: reformat all CUDA files with nixfmt-rfc-style 2023-03-01 ```bash nix run github:NixOS/nixpkgs/ab6071eb54cc9b66dda436111d4f569e4e56cbf4#nixfmt-rfc-style -L --allow-import-from-derivation -- pkgs/development/cuda-modules pkgs/test/cuda pkgs/top-level/cuda-packages.nix ```
c93591b
to
d94495d
Compare
Concerns have been addressed; pending another review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good to me! I opened NixOS/nixfmt#180 to track a generic GitHub workflow file.
We'll discuss this PR in today's formatting team meeting and will most likely merge it then :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(discussed in the formatting team meeting)
Can confirm that the workflow works (tweag#88), let's merge!
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/formatting-team-meeting-2024-04-02/42658/1 |
Woohoo!! thanks everyone -- excited to finally get some auto-formatting CI in nixpkgs! |
Thank you all for being the first-out-of-the-gate team to opt in to RFC 166! |
Description of changes
Reformats the following paths with
nixfmt-rfc-style
:pkgs/development/cuda-modules
pkgs/test/cuda
pkgs/top-level/cuda-packages.nix
Additionally, adds the commit in which the reformatting happens to
.git-blame-ignore-revs
.Ideally this will not cause any rebuilds, but it may if whitespace in raw text blocks change.
This PR also introduces a workflow to ensure that the changed files continue to stay formatted.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.